home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2006 May / PCpro_2006_05.ISO / files / mobile / fma-2.0-stable-setup.exe / {app} / sframework / plugins / MediaPlayer9.vbs < prev    next >
Encoding:
Text File  |  2004-12-10  |  4.0 KB  |  147 lines

  1. 'FMA Script Framework Plugin
  2. 'MediaPlayer9
  3. 'Allows for controlling MS Media Player 9
  4.  
  5. 'TODO:
  6. '-nothing atm
  7.  
  8. Class MediaPlayer9
  9.     
  10.     Private llist
  11.     Private m_Self
  12.     Private m_volsteps
  13.     Private mainMenu
  14.     
  15.     'Some info about the plugin
  16.     Public Property Get SHOWABLE 'Do I have a menu?
  17.         SHOWABLE    = True
  18.     End Property
  19.     Public Property Get TITLE 'What's my name?
  20.         TITLE       = "Media Player 9"
  21.     End Property
  22.     Public Property Get DESCRIPTION 'What's my purpose?
  23.         DESCRIPTION = "Allows for controlling MS Media Player 9"
  24.     End Property
  25.     Public Property Get AUTHOR 'Who created me?
  26.         AUTHOR      = "streawkceur (inspired by ultimatex)"
  27.     End Property
  28.     Public Property Get URL 'Were can I be found? Where can you get more information?
  29.         URL = "http://fma.xinium.com/"
  30.     End Property
  31.     
  32.     'Who am I?
  33.     Public Property Let Self (s)
  34.         m_Self = s
  35.         ' Some init stuff here:
  36.         If IsEmpty(Settings(Me, "Title")) or Settings(Me, "Title") = "" Then Settings(Me, "Title") = "Windows Media Player"
  37.         If IsEmpty(Settings(Me, "Exe"))   or Settings(Me, "Exe")   = "" Then Settings(Me, "Exe")   = "C:\Program Files\Windows Media Player\wmplayer.exe"
  38.         Set mainMenu = New ManagedMenu
  39.         mainMenu.Title = TITLE
  40.     End Property
  41.     Public Property Get Self
  42.         Self = m_Self
  43.     End Property
  44.     
  45.     'Display me. Eventually put a menu on the screen
  46.     Sub Show()
  47.         '--> Menu: LinkedList Style. Sorted and very handy. This would be the one of choice
  48.         Set llist = New LinkedList
  49.         Dim bi
  50.         bi = llist.BackInserter
  51.         If WMPOpen Then
  52.             bi.Item = Array("Play/Pause", Self & ".Play")
  53.             bi.Item = Array("Stop",       Self & ".Stopp")
  54.             bi.Item = Array("Shuffle",    Self & ".Shuffle")
  55.             bi.Item = Array("Next Track", Self & ".NextTrack")
  56.             bi.Item = Array("Prev Track", Self & ".PrevTrack")
  57.             bi.Item = Array("Volume",     Self & ".Volume")
  58.             bi.Item = Array("Mute",       Self & ".Mute")
  59.             bi.Item = Array("Fullscreen", Self & ".Fullscreen")
  60.             bi.Item = Array("Close",      Self & ".Close")
  61.         Else
  62.             bi.Item = Array("Launch",     Self & ".Launch")
  63.         End If
  64.         mainMenu.SetList llist
  65.         mainMenu.ShowMenu
  66.     End Sub
  67.     
  68.     Function WMPOpen
  69.         WMPOpen = Shell.AppActivate(Settings(Me, "Title"))
  70.     End Function
  71.     
  72.     Sub Launch
  73.         If Fso.FileExists(Settings(Me, "Exe")) Then
  74.             Shell.Exec Settings(Me, "Exe")
  75.             Util.WaitForAppLoad Settings(Me, "Title"), 10000 'Give WMP max. 10 secs to load
  76.         Else
  77.             Debug.ErrorMsg Self & " - Launch: File not found: " & Settings(Me, "Exe")
  78.         End If
  79.         Show
  80.     End Sub
  81.     
  82.     Sub Play
  83.         If WMPOpen Then Shell.SendKeys "^p"
  84.         am.Update    
  85.     End Sub
  86.     
  87.     Sub Stopp
  88.         If WMPOpen Then Shell.SendKeys "^s"
  89.         am.Update    
  90.     End Sub
  91.     
  92.     Sub Shuffle
  93.         If WMPOpen Then Shell.SendKeys "^h"
  94.         am.Update    
  95.     End Sub
  96.     
  97.     Sub Mute
  98.         If WMPOpen Then Shell.SendKeys "{F8}"
  99.         am.Update    
  100.     End Sub
  101.     
  102.     Sub Fullscreen
  103.         If WMPOpen Then Shell.SendKeys "%{ENTER}"
  104.         am.Update    
  105.     End Sub
  106.     
  107.     Sub PrevTrack
  108.         If WMPOpen Then Shell.SendKeys "^b"
  109.         am.Update    
  110.     End Sub
  111.     
  112.     Sub NextTrack
  113.         If WMPOpen Then Shell.SendKeys "^f"
  114.         am.Update    
  115.     End Sub
  116.     
  117.     Sub Close
  118.         If WMPOpen Then Shell.SendKeys "%{F4}"
  119.         Show    
  120.     End Sub
  121.     
  122.     Sub Volume
  123.         EmptyMenu.ShowMenu 'Push empty menu to prevent page swapping of the last menu
  124.         am.Back = Self & ".QuitVolume" 'Mangage the menu quit by ourselves
  125.         am.DlgMsgBox "Use your joystick or phone volume keys! Up/down: In-/decrease volume. Back/JoyPress to exit"
  126.         KeyManager.RegisterKey KEY_JOYUP,    Self & ".IncVol",     STATE_PRESS, Me
  127.         KeyManager.RegisterKey KEY_JOYDOWN,  Self & ".DecVol",     STATE_PRESS, Me
  128.         KeyManager.RegisterKey KEY_VOLUP,    Self & ".IncVol",     STATE_PRESS, Me
  129.         KeyManager.RegisterKey KEY_VOLDOWN,  Self & ".DecVol",     STATE_PRESS, Me
  130.     End Sub
  131.     
  132.     Sub QuitVolume
  133.         KeyManager.DeregisterAll Me
  134.         MenuStack.Top.Quit 'remove empty menu. this will also show the previous menu
  135.     End Sub
  136.     
  137.     Sub DecVol
  138.         If WMPOpen Then Shell.SendKeys "{F9}"
  139.     End Sub
  140.     
  141.     Sub IncVol
  142.         If WMPOpen Then Shell.SendKeys "{F10}"
  143.     End Sub
  144.     
  145. End Class
  146.  
  147.